﻿<!-- #include file="../Include/Admin_Onlogin.asp" -->
<%
Data_Name = "{prefix}Admin_Auth"
strFileName = "Admin_AdminAuth.asp"
Dim sqlAuth, rsAuth, PurviewID
sqlAuth = "Select AuthID From "&Data_Name&" Where href='Admin/" & strFileName & "' Order By sort Asc,AuthID Asc"
Call Exec(rsAuth,sqlAuth,2)
If rsAuth.BOF And rsAuth.EOF Then
	PurviewID = 0
Else
	PurviewID = rsAuth(0)
	CheckPurview PurviewID,0
End If
rsAuth.Close
Set rsAuth = Nothing
Select Case Action
Case "Add"
	sqlAuth = "Select AuthID From "&Data_Name&" Where pid="&PurviewID&" And href='AdminAuth/Add' Order By sort Asc,AuthID Asc"
	Call Exec(rsAuth,sqlAuth,2)
	If rsAuth.BOF And rsAuth.EOF Then
		CheckPurview 0,0
	Else
		CheckPurview rsAuth(0),0
	End If
	rsAuth.Close
	Set rsAuth = Nothing
    Call AddAuth()
Case "SaveAdd"
	sqlAuth = "Select AuthID From "&Data_Name&" Where pid="&PurviewID&" And href='AdminAuth/Insert' Order By sort Asc,AuthID Asc"
	Call Exec(rsAuth,sqlAuth,2)
	If rsAuth.BOF And rsAuth.EOF Then
		CheckPurview 0,1
	Else
		CheckPurview rsAuth(0),1
	End If
	rsAuth.Close
	Set rsAuth = Nothing
    Call SaveAdd()
Case "Modify"
	sqlAuth = "Select AuthID From "&Data_Name&" Where pid="&PurviewID&" And href='AdminAuth/Edit' Order By sort Asc,AuthID Asc"
	Call Exec(rsAuth,sqlAuth,2)
	If rsAuth.BOF And rsAuth.EOF Then
		CheckPurview 0,0
	Else
		CheckPurview rsAuth(0),0
	End If
	rsAuth.Close
	Set rsAuth = Nothing
    Call Modify()
Case "SaveModify"
	sqlAuth = "Select AuthID From "&Data_Name&" Where pid="&PurviewID&" And href='AdminAuth/Update' Order By sort Asc,AuthID Asc"
	Call Exec(rsAuth,sqlAuth,2)
	If rsAuth.BOF And rsAuth.EOF Then
		CheckPurview 0,1
	Else
		CheckPurview rsAuth(0),1
	End If
	rsAuth.Close
	Set rsAuth = Nothing
    Call SaveModify()
Case "AuthOpen"
	sqlAuth = "Select AuthID From "&Data_Name&" Where pid="&PurviewID&" And href='AdminAuth/Rule' Order By sort Asc,AuthID Asc"
	Call Exec(rsAuth,sqlAuth,2)
	If rsAuth.BOF And rsAuth.EOF Then
		CheckPurview 0,1
	Else
		CheckPurview rsAuth(0),1
	End If
	rsAuth.Close
	Set rsAuth = Nothing
	AuthOpen()
Case "AuthState"
	sqlAuth = "Select AuthID From "&Data_Name&" Where pid="&PurviewID&" And href='AdminAuth/State' Order By sort Asc,AuthID Asc"
	Call Exec(rsAuth,sqlAuth,2)
	If rsAuth.BOF And rsAuth.EOF Then
		CheckPurview 0,1
	Else
		CheckPurview rsAuth(0),1
	End If
	rsAuth.Close
	Set rsAuth = Nothing
	AuthState()
Case "ListOrder"
	sqlAuth = "Select AuthID From "&Data_Name&" Where pid="&PurviewID&" And href='AdminAuth/Order' Order By sort Asc,AuthID Asc"
	Call Exec(rsAuth,sqlAuth,2)
	If rsAuth.BOF And rsAuth.EOF Then
		CheckPurview 0,1
	Else
		CheckPurview rsAuth(0),1
	End If
	rsAuth.Close
	Set rsAuth = Nothing
	ListOrder()
Case "Del"
	sqlAuth = "Select AuthID From "&Data_Name&" Where pid="&PurviewID&" And href='AdminAuth/Del' Order By sort Asc,AuthID Asc"
	Call Exec(rsAuth,sqlAuth,2)
	If rsAuth.BOF And rsAuth.EOF Then
		CheckPurview 0,1
	Else
		CheckPurview rsAuth(0),1
	End If
	rsAuth.Close
	Set rsAuth = Nothing
    Call DelAuth()
Case Else
    Call Main()
End Select
If FoundErr = True Then
	Call WriteErrMsg(ErrMsg, ComeUrl)
End If
Call CloseConn()

Sub Main()
	If Request.ServerVariables("REQUEST_METHOD") = "POST" Then
		Sql = "Select * From ["&Data_Name&"] Order By sort Asc,AuthID Asc"
		Call Exe_Conn(Rs,Sql,1)
		i = 0
		If Rs.BOF And Rs.EOF Then
			data = ""
		Else
			totalPut = Rs.RecordCount
			Do While Not Rs.Eof
				If i=0 Then
					data = data & "{""id"":"&Rs("AuthID")&",""title"":"""&ToUnicode(Rs("title"))&""",""href"":"""&Rs("href")&""",""type"":"""&Rs("type")&""",""status"":"""&Rs("status")&""",""authopen"":"""&Rs("authopen")&""",""icon"":"""&Rs("icon")&""",""condition"":"""&Rs("condition")&""",""pid"":"&Rs("pid")&",""sort"":"""&Rs("sort")&""",""addtime"":"""&Rs("addtime")&""",""zt"":"""&Rs("zt")&""",""menustatus"":"""&Rs("menustatus")&"""}"
				Else
					data = data & ",{""id"":"&Rs("AuthID")&",""title"":"""&ToUnicode(Rs("title"))&""",""href"":"""&Rs("href")&""",""type"":"""&Rs("type")&""",""status"":"""&Rs("status")&""",""authopen"":"""&Rs("authopen")&""",""icon"":"""&Rs("icon")&""",""condition"":"""&Rs("condition")&""",""pid"":"&Rs("pid")&",""sort"":"""&Rs("sort")&""",""addtime"":"""&Rs("addtime")&""",""zt"":"""&Rs("zt")&""",""menustatus"":"""&Rs("menustatus")&"""}"
				End If
				Rs.MoveNext
				i=i+1
			Loop
			Rs.Close
		End If
		If totalPut = 0 Then
			Response.Write "{""code"":201,""msg"":""\u65e0\u6570\u636e""}" & vbCrLf
		Else
			Response.Write "{""code"":0,""msg"":""\u83b7\u53d6\u6210\u529f!"",""count"":"&totalPut&",""data"":["&data&"],""rel"":1}" & vbCrLf
		End If
		Response.End()
	Else
		Response.Write "<!DOCTYPE html>" & vbCrLf
		Response.Write "<head>" & vbCrLf
		Response.Write "<title>权限管理</title>" & vbCrlf
		Response.Write "<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>" & vbCrLf
		Response.Write "<meta name='viewport' content='width=device-width, initial-scale=1, maximum-scale=1'>" & vbCrLf
		Response.Write "<meta name='apple-mobile-web-app-status-bar-style' content='black'>" & vbCrLf
		Response.Write "<meta name='apple-mobile-web-app-capable' content='yes'>" & vbCrLf
		Response.Write "<meta name='format-detection' content='telephone=no'>" & vbCrLf
		Response.Write "<link rel=""stylesheet"" type=""text/css"" href=""../fonts/font-awesome/css/font-awesome.min.css"" />" & vbCrLf
		Response.Write "<link href='../Plugins/layui/css/layui.css' rel='stylesheet' type='text/css' />" & vbCrLf
		Response.Write "<link rel=""stylesheet"" href=""../Style/global.css"" media=""all"">" & vbCrLf
		Response.Write "<link rel=""stylesheet"" href=""../Style/font.css"" media=""all"">" & vbCrLf
		Response.Write "<script type='text/javascript'>" & vbCrLf
		Response.Write "var pc_file = '" & InstallDir & "';" & vbCrLf
		Response.Write "var admin_file = '" & AdminFolder & "/';" & vbCrLf
		Response.Write "</script>" & vbCrLf
		Response.Write "<script type='text/javascript' src='../Js/Admin.js'></script>" & vbCrLf
		Response.Write "<script type='text/javascript' src='../../Dialog/main.js'></script>" & vbCrLf
		Response.Write "<script type='text/javascript' src='../../Dialog/lhgcore.min.js'></script>" & vbCrLf
		Response.Write "<script type='text/javascript' src='../../Dialog/lhgcalendar.min.js'></script>" & vbCrLf
		Response.Write "<script type=""text/javascript"" src=""../Plugins/layui/layui.js""></script>" & vbCrLf
		Response.Write "</head>" & vbCrlf
		Response.Write "<body>" & vbCrlf
		Response.Write "<div class=""admin-main layui-anim layui-anim-upbit"">" & vbCrlf
		Response.Write "    <fieldset class=""layui-elem-field layui-field-title"">" & vbCrlf
		Response.Write "        <legend>权限管理</legend>" & vbCrlf
		Response.Write "    </fieldset>" & vbCrlf
		Response.Write "    <blockquote class=""layui-elem-quote"">" & vbCrlf
		Response.Write "        <a href=""?Action=Add"" class=""layui-btn layui-btn-sm"">" & vbCrlf
		Response.Write "            <i class=""fa fa-plus""></i> 添加权限" & vbCrlf
		Response.Write "        </a>" & vbCrlf
		Response.Write "        <a class=""layui-btn layui-btn-normal layui-btn-sm""  onclick=""openAll();"">" & vbCrlf
		Response.Write "            <i class=""fa fa-folder-open-o""></i> 展开或折叠全部" & vbCrlf
		Response.Write "        </a>" & vbCrlf
		Response.Write "    </blockquote>" & vbCrlf
		Response.Write "    <table class=""layui-table"" id=""treeTable"" lay-filter=""treeTable""></table>" & vbCrlf
		Response.Write "</div>" & vbCrlf
		Response.Write "<script type=""text/html"" id=""auth"">" & vbCrLf
		Response.Write "    <input type=""checkbox"" name=""authopen"" value=""{{d.id}}"" lay-skin=""switch"" lay-text=""是|否"" lay-filter=""authopen"" {{ d.authopen == 0 ? 'checked' : '' }}>" & vbCrLf
		Response.Write "</script>" & vbCrLf
		Response.Write "<script type=""text/html"" id=""status"">" & vbCrLf
		Response.Write "    <input type=""checkbox"" name=""menustatus"" value=""{{d.id}}"" lay-skin=""switch"" lay-text=""显示|隐藏"" lay-filter=""menustatus"" {{ d.menustatus == 1 ? 'checked' : '' }}>" & vbCrLf
		Response.Write "</script>" & vbCrLf
		Response.Write "<script type=""text/html"" id=""order"">" & vbCrLf
		Response.Write "    <input name=""{{d.id}}"" data-id=""{{d.id}}"" class=""list_order layui-input"" value=""{{d.sort}}"" size=""10""/>" & vbCrLf
		Response.Write "</script>" & vbCrLf
		Response.Write "<script type=""text/html"" id=""icon"">" & vbCrlf
		Response.Write "    <span class=""icon {{d.icon}}""></span>" & vbCrlf
		Response.Write "</script>" & vbCrlf
		Response.Write "<script type=""text/html"" id=""action"">" & vbCrlf
		Response.Write "    <a href=""?Action=Add&pid={{d.id}}"" class=""layui-btn layui-btn-xs""><i class=""fa fa-plus""></i> 添加父级</a>" & vbCrlf
		Response.Write "    {{# if(d.id>'295'){ }}" & vbCrlf
		Response.Write "    <a href=""?Action=Modify&AuthID={{d.id}}"" class=""layui-btn layui-btn-xs""><i class=""fa fa-edit""></i> 编辑</a>" & vbCrlf
		Response.Write "    <a class=""layui-btn layui-btn-danger layui-btn-xs"" lay-event=""del""><i class=""fa fa-trash-o""></i> 删除</a>" & vbCrlf
		Response.Write "    {{# } }}" & vbCrlf
		Response.Write "</script>" & vbCrlf
		Response.Write "<script type=""text/html"" id=""topBtn"">" & vbCrlf
		Response.Write "   <a href=""?Action=Add"" class=""layui-btn layui-btn-sm"">添加权限</a>" & vbCrlf
		Response.Write "</script>" & vbCrlf
		Response.Write "<script>" & vbCrlf
		Response.Write "    var editObj=null,ptable=null,treeGrid=null,tableId='treeTable',layer=null;" & vbCrlf
		Response.Write "    layui.config({" & vbCrlf
		Response.Write "        base: pc_file + admin_file + '/Plugins/layui/extend/'" & vbCrlf
		Response.Write "    }).extend({" & vbCrlf
		Response.Write "        treeGrid:'treeGrid'" & vbCrlf
		Response.Write "    }).use(['jquery','treeGrid','layer','form'], function(){" & vbCrlf
		Response.Write "        var $=layui.jquery;" & vbCrlf
		Response.Write "        treeGrid = layui.treeGrid;" & vbCrlf
		Response.Write "        layer=layui.layer;" & vbCrlf
		Response.Write "		form = layui.form;" & vbCrlf
		Response.Write "        ptable=treeGrid.render({" & vbCrlf
		Response.Write "            id:tableId" & vbCrlf
		Response.Write "            ,elem: '#'+tableId" & vbCrlf
		Response.Write "            ,idField:'id'" & vbCrlf
		Response.Write "            ,url:'?Action=Main'" & vbCrlf
		Response.Write "            ,method: 'post'" & vbCrLf
		Response.Write "            ,cellMinWidth: 100" & vbCrlf
		Response.Write "            ,treeId:'id'//树形id字段名称" & vbCrlf
		Response.Write "            ,treeUpId:'pid'//树形父id字段名称" & vbCrlf
		Response.Write "            ,treeShowName:'title'//以树形式显示的字段" & vbCrlf
		Response.Write "            ,height:'full-140'" & vbCrlf
		Response.Write "            ,isFilter:false" & vbCrlf
		Response.Write "            ,iconOpen:true//是否显示图标【默认显示】" & vbCrlf
		Response.Write "            ,isOpenDefault:true//节点默认是展开还是折叠【默认展开】" & vbCrlf
		Response.Write "            ,cols: [[" & vbCrlf
		Response.Write "                {field: 'id', title: '编号', width: 70, fixed: true}," & vbCrLf
		Response.Write "                {field: 'icon', align: 'center',title: '图标', width: 60,templet: '#icon'}," & vbCrLf
		Response.Write "                {field: 'title', title: '权限名称', width: 200}," & vbCrLf
		Response.Write "                {field: 'href', title: '权限链接', width: 360}," & vbCrLf
		Response.Write "                {field: 'authopen',align: 'center', title: '是否验证权限', width: 150,toolbar: '#auth'}," & vbCrLf
		Response.Write "                {field: 'menustatus',align: 'center',title: '菜单状态', width: 150,toolbar: '#status'}," & vbCrLf
		Response.Write "                {field: 'sort',align: 'center', title: '排序', width: 80, templet: '#order'}," & vbCrLf
		Response.Write "                {title: '操作',width: 240,align: 'center', toolbar: '#action'}" & vbCrLf
		Response.Write "            ]]" & vbCrlf
		Response.Write "            ,page:false" & vbCrlf
		Response.Write "        });" & vbCrlf
		Response.Write "        treeGrid.on('tool('+tableId+')',function (obj) {" & vbCrlf
		Response.Write "			var data = obj.data;" & vbCrlf
		Response.Write "            if(obj.event === 'del'){" & vbCrlf
		Response.Write "                layer.confirm('您确定要删除该记录吗？', function(index){" & vbCrlf
		Response.Write "                    $.ajax({" & vbCrLf
		Response.Write "                        type: 'post'," & vbCrLf
		Response.Write "                        url: '?Action=Del'," & vbCrLf
		Response.Write "                        data: {AuthID:data.id}," & vbCrLf
		Response.Write "                        dataType: 'json'," & vbCrLf
		Response.Write "                        success: function(res) {" & vbCrLf
		Response.Write "                            if (res.code == 1) {" & vbCrLf
		Response.Write "                                layer.msg(res.msg,{time:1000,icon:1});" & vbCrLf
		Response.Write "                                obj.del();" & vbCrLf
		Response.Write "                            }else{" & vbCrLf
		Response.Write "                                layer.msg(res.msg,{time:1000,icon:2});" & vbCrLf
		Response.Write "                            }" & vbCrLf
		Response.Write "                        }" & vbCrLf
		Response.Write "                    });" & vbCrLf
		Response.Write "                    layer.close(index);" & vbCrlf
		Response.Write "                });" & vbCrlf
		Response.Write "            }" & vbCrlf
		Response.Write "        });" & vbCrlf
		Response.Write "        form.on('switch(authopen)', function(obj){" & vbCrLf
		Response.Write "            loading = layer.load(1, {shade: [0.1,'#fff']});" & vbCrLf
		Response.Write "            var id = this.value;" & vbCrLf
		Response.Write "            var authopen = obj.elem.checked===true?0:1;" & vbCrLf
		Response.Write "            $.ajax({" & vbCrLf
		Response.Write "                type: 'post'," & vbCrLf
		Response.Write "                url: '?Action=AuthOpen'," & vbCrLf
		Response.Write "                data: {AuthID:id,authopen:authopen}," & vbCrLf
		Response.Write "                dataType: 'json'," & vbCrLf
		Response.Write "                success: function(res) {" & vbCrLf
		Response.Write "                    layer.close(loading);" & vbCrlf
		Response.Write "                    if(res.code == 1){" & vbCrlf
		Response.Write "                        treeGrid.render;" & vbCrlf
		Response.Write "                    }else{" & vbCrlf
		Response.Write "                        layer.msg(res.msg,{time:1000,icon:2});" & vbCrlf
		Response.Write "                        treeGrid.render;" & vbCrlf
		Response.Write "                        return false;" & vbCrlf
		Response.Write "                    }" & vbCrlf
		Response.Write "                }" & vbCrLf
		Response.Write "            });" & vbCrLf
		Response.Write "        });" & vbCrLf
		Response.Write "		form.on('switch(menustatus)', function(obj){" & vbCrLf
		Response.Write "            loading = layer.load(1, {shade: [0.1,'#fff']});" & vbCrLf
		Response.Write "            var id = this.value;" & vbCrLf
		Response.Write "            var menustatus = obj.elem.checked===true?1:0;" & vbCrLf
		Response.Write "            $.ajax({" & vbCrLf
		Response.Write "                type: 'post'," & vbCrLf
		Response.Write "                url: '?Action=AuthState'," & vbCrLf
		Response.Write "                data: {AuthID:id,menustatus:menustatus}," & vbCrLf
		Response.Write "                dataType: 'json'," & vbCrLf
		Response.Write "                success: function(res) {" & vbCrLf
		Response.Write "                    layer.close(loading);" & vbCrlf
		Response.Write "                    if(res.code == 1){" & vbCrlf
		Response.Write "                        treeGrid.render;" & vbCrlf
		Response.Write "                    }else{" & vbCrlf
		Response.Write "                        layer.msg(res.msg,{time:1000,icon:2});" & vbCrlf
		Response.Write "                        treeGrid.render;" & vbCrlf
		Response.Write "                        return false;" & vbCrlf
		Response.Write "                    }" & vbCrlf
		Response.Write "                }" & vbCrLf
		Response.Write "            });" & vbCrLf
		Response.Write "        });" & vbCrLf
		Response.Write "        $('body').on('blur','.list_order',function() {" & vbCrlf
		Response.Write "            var id = $(this).attr('data-id');" & vbCrlf
		Response.Write "            var sort = $(this).val();" & vbCrlf
		Response.Write "            var loading = layer.load(1, {shade: [0.1, '#fff']});" & vbCrlf
		Response.Write "            $.ajax({" & vbCrLf
		Response.Write "                type: 'post'," & vbCrLf
		Response.Write "                url: '?Action=ListOrder'," & vbCrLf
		Response.Write "                data: {AuthID:id,sort:sort}," & vbCrLf
		Response.Write "                dataType: 'json'," & vbCrLf
		Response.Write "                success: function(res) {" & vbCrLf
		Response.Write "                    layer.close(loading);" & vbCrlf
		Response.Write "                    if(res.code === 1){" & vbCrlf
		Response.Write "                        layer.msg(res.msg, {time: 1000, icon: 1}, function () {" & vbCrlf
		Response.Write "                            location.href = res.url;" & vbCrlf
		Response.Write "                        });" & vbCrlf
		Response.Write "                    }else{" & vbCrlf
		Response.Write "                        layer.msg(res.msg,{time:1000,icon:2});" & vbCrlf
		Response.Write "                        treeGrid.render;" & vbCrlf
		Response.Write "                    }" & vbCrlf
		Response.Write "                }" & vbCrLf
		Response.Write "            });" & vbCrLf
		Response.Write "        });" & vbCrlf
		Response.Write "    });" & vbCrlf
		Response.Write "    function openAll() {" & vbCrlf
		Response.Write "        var treedata=treeGrid.getDataTreeList(tableId);" & vbCrlf
		Response.Write "        treeGrid.treeOpenAll(tableId,!treedata[0][treeGrid.config.cols.isOpen]);" & vbCrlf
		Response.Write "    }" & vbCrlf
		Response.Write "</script>" & vbCrlf
		Response.Write "</body>" & vbCrLf & "</html>"
	End If
End Sub

Sub AddAuth()
	pid = Code_CLng(Trim(Request("pid")))
	Response.Write "<!DOCTYPE html>" & vbCrLf
	Response.Write "<head>" & vbCrLf
	Response.Write "<title>权限管理</title>" & vbCrLf
	Response.Write "<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>" & vbCrLf
	Response.Write "<meta name='viewport' content='width=device-width, initial-scale=1, maximum-scale=1'>" & vbCrLf
	Response.Write "<meta name='apple-mobile-web-app-status-bar-style' content='black'>" & vbCrLf
	Response.Write "<meta name='apple-mobile-web-app-capable' content='yes'>" & vbCrLf
	Response.Write "<meta name='format-detection' content='telephone=no'>" & vbCrLf
	Response.Write "<link rel=""stylesheet"" type=""text/css"" href=""../fonts/font-awesome/css/font-awesome.min.css"" />" & vbCrLf
	Response.Write "<link href='../Plugins/layui/css/layui.css' rel='stylesheet' type='text/css' />" & vbCrLf
	Response.Write "<link href='../Style/global.css' rel='stylesheet' type='text/css' />" & vbCrLf
	Response.Write "<link href='../Style/font.css' rel='stylesheet' type='text/css' />" & vbCrLf
	Response.Write "<script type='text/javascript'>" & vbCrLf
	Response.Write "var pc_file = '" & InstallDir & "';" & vbCrLf
	Response.Write "var admin_file = '" & AdminFolder & "/';" & vbCrLf
	Response.Write "</script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../Js/Admin.js'></script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../../Dialog/main.js'></script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../../Dialog/lhgcore.min.js'></script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../../Dialog/lhgcalendar.min.js'></script>" & vbCrLf
	Response.Write "<script type=""text/javascript"" src=""../Plugins/layui/layui.js""></script>" & vbCrLf
	Response.Write "<script type=""text/javascript"" src=""../Plugins/xm-select/xm-select.js""></script>" & vbCrLf
	Response.Write "</head>" & vbCrLf
	Response.Write "<body>" & vbCrLf
	Response.Write "<form class='layui-form layui-form-pane' id=""myform"" name=""myform"" method='post' action='" & strFileName & "'>" & vbCrLf
	Response.Write "<div class=""admin-main fadeInUp animated"">" & vbCrlf
	Response.Write "    <fieldset class=""layui-elem-field layui-field-title"">" & vbCrlf
	Response.Write "        <legend>添加权限</legend>" & vbCrlf
	Response.Write "    </fieldset>" & vbCrlf
	Response.Write "    <div class=""layui-form-item"">" & vbCrlf
	Response.Write "        <label class=""layui-form-label"">父级：</label>" & vbCrlf
	Response.Write "        <div class=""layui-input-4"">" & vbCrlf
	Response.Write "            <div id=""pid"" class=""xm-select-demo""></div>" & vbCrlf
	Response.Write "        </div>" & vbCrlf
	Response.Write "    </div>" & vbCrlf
	Response.Write "    <div class=""layui-form-item"">" & vbCrlf
	Response.Write "        <label class=""layui-form-label"">权限名称：</label>" & vbCrlf
	Response.Write "        <div class=""layui-input-4"">" & vbCrlf
	Response.Write "            <input name=""title"" type=""text"" id=""title"" size=""30"" maxlength=""255"" value="""" lay-verify=""required"" placeholder=""请输入权限名称"" class=""layui-input"">" & vbCrlf
	Response.Write "        </div>" & vbCrlf
	Response.Write "    </div>" & vbCrlf
	Response.Write "    <div class=""layui-form-item"">" & vbCrlf
	Response.Write "        <label class=""layui-form-label"">权限链接：</label>" & vbCrlf
	Response.Write "        <div class=""layui-input-4"">" & vbCrlf
	Response.Write "            <input name=""href"" type=""text"" id=""href"" size=""30"" maxlength=""255"" value="""" lay-verify=""required"" placeholder=""请输入权限链接"" class=""layui-input"">" & vbCrlf
	Response.Write "        </div>" & vbCrlf
	Response.Write "    </div>" & vbCrlf
	Response.Write "    <div class=""layui-form-item"">" & vbCrlf
	Response.Write "        <label class=""layui-form-label"">图标名称：</label>" & vbCrlf
	Response.Write "        <div class=""layui-input-4"">" & vbCrlf
	Response.Write "            <input name=""icon"" type=""text"" id=""icon"" size=""30"" maxlength=""255"" value="""" placeholder=""请输入图标名称"" class=""layui-input"">" & vbCrlf
	Response.Write "        </div>" & vbCrlf
	Response.Write "    </div>" & vbCrlf
	Response.Write "    <div class=""layui-form-item"">" & vbCrlf
	Response.Write "        <label class=""layui-form-label"">状态：</label>" & vbCrlf
	Response.Write "        <div class=""layui-input-4"">" & vbCrlf
	Response.Write "            <input id='menustatus' name='menustatus' type='radio' value='1' checked title='开启' lay-filter='menustatus'><input type='radio' id='menustatus' name='menustatus' value='0' title='关闭' lay-filter='menustatus'>" & vbCrlf
	Response.Write "        </div>" & vbCrlf
	Response.Write "    </div>" & vbCrlf
	Response.Write "    <div class=""layui-form-item"">" & vbCrlf
	Response.Write "        <label class=""layui-form-label"">排序：</label>" & vbCrlf
	Response.Write "        <div class=""layui-input-4"">" & vbCrlf
	Response.Write "            <input name=""sort"" type=""text"" id=""sort"" size=""30"" maxlength=""255"" value=""0"" lay-verify=""required"" placeholder=""请输入排序编号"" class=""layui-input"">" & vbCrlf
	Response.Write "        </div>" & vbCrlf
	Response.Write "    </div>" & vbCrlf
	Response.Write "</div>" & vbCrlf
	Response.Write "<br>" & vbCrlf
	Response.Write "<br>" & vbCrlf
	Response.Write "<br>" & vbCrlf
	Response.Write "<br>" & vbCrlf
	Response.Write "<br>" & vbCrlf
	Response.Write "<br>" & vbCrlf
	Response.Write "<br>" & vbCrlf
	Response.Write "<br>" & vbCrlf
	Response.Write "<input type=""hidden"" name=""Action"" id='Action' value=""SaveAdd""><input name='Scode' type='hidden' id='Scode' value='" & CheckSecretCode("start") & "'>" & Submit_Layui("提交添加","重新填写","确认要清空对话框内容？","javascript:history.back();","返回上一页","") & vbCrlf
	Response.Write "</form>" & vbCrLf
	Response.Write "<script>" & vbCrlf
	Response.Write "layui.use(['form'], function () {" & vbCrlf
	Response.Write "    var form = layui.form;" & vbCrlf
	Response.Write "    var pid = xmSelect.render({" & vbCrLf
	Response.Write "        el: '#pid'," & vbCrLf
	Response.Write "        name: 'pid'," & vbCrLf
	Response.Write "        radio: true," & vbCrLf
	Response.Write "        clickClose: true," & vbCrLf
	'Response.Write "        tips: '指定栏目的" & ChannelTit & "?'," & vbCrLf
	'Response.Write "        empty: '呀, 没有数据呢'," & vbCrLf
	Response.Write "        autoRow: true," & vbCrLf
	Response.Write "        filterable: true," & vbCrLf
	Response.Write "        height: '300px'," & vbCrLf
	Response.Write "        direction: 'down'," & vbCrLf
	Response.Write "        tree: {" & vbCrLf
	Response.Write "            show: true,//是否显示树状结构" & vbCrLf
	Response.Write "            showFolderIcon: true,//是否展示三角图标" & vbCrLf
	Response.Write "            showLine: true,//是否显示虚线" & vbCrLf
	Response.Write "            indent: 20,//间距" & vbCrLf
	Response.Write "            expandedKeys: true,//默认展开节点的数组, 为 true 时, 展开所有节点" & vbCrLf
	Response.Write "            strict: false,//是否严格遵守父子模式" & vbCrLf
	Response.Write "        }," & vbCrLf
	Response.Write "        toolbar: {" & vbCrLf
	Response.Write "            show: false," & vbCrLf
	Response.Write "            list: ['ALL', 'REVERSE', 'CLEAR']" & vbCrLf
	Response.Write "        }," & vbCrLf
	Response.Write "        data: [" & vbCrLf
	Response.Write "            {name: '作为一级栏目', value: 0"
	If Int(Pid)=Int(0) Then Response.Write ", selected: true"
	Response.Write "}," & vbCrLf
	Response.Write Class_Add_Edit_List(0, pid)
	Response.Write "        ]" & vbCrLf
	Response.Write "    })" & vbCrLf
	Response.Write "    //提交监听" & vbCrlf
	Response.Write "    form.on('submit(submit)', function (data) {" & vbCrlf
	Response.Write "        loading = layer.load(1, {shade: [0.1,'#fff']});" & vbCrlf
	Response.Write "        $.ajax({" & vbCrLf
	Response.Write "            type: 'post'," & vbCrLf
	Response.Write "            url: '?Action=SaveAdd'," & vbCrLf
	Response.Write "            data: data.field," & vbCrLf
	Response.Write "            dataType: 'json'," & vbCrLf
	Response.Write "            success: function(res) {" & vbCrLf
	Response.Write "                layer.close(loading);" & vbCrlf
	Response.Write "                if(res.code > 0){" & vbCrlf
	Response.Write "                    layer.msg(res.msg,{icon: 1, time: 1000},function(){" & vbCrlf
	Response.Write "                        location.href = res.url;" & vbCrlf
	Response.Write "                    });" & vbCrlf
	Response.Write "                }else{" & vbCrlf
	Response.Write "                    layer.msg(res.msg,{icon: 2, time: 1000});" & vbCrlf
	Response.Write "                }" & vbCrlf
	Response.Write "            }" & vbCrLf
	Response.Write "        });" & vbCrLf
	Response.Write "    });" & vbCrlf
	Response.Write "});" & vbCrlf
	Response.Write "</script>" & vbCrlf
	Response.Write "</body>" & vbCrLf & "</html>"
End Sub

Sub Modify()
	Response.Write "<!DOCTYPE html>" & vbCrLf
	Response.Write "<head>" & vbCrLf
	Response.Write "<title>权限管理</title>" & vbCrLf
	Response.Write "<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>" & vbCrLf
	Response.Write "<meta name='viewport' content='width=device-width, initial-scale=1, maximum-scale=1'>" & vbCrLf
	Response.Write "<meta name='apple-mobile-web-app-status-bar-style' content='black'>" & vbCrLf
	Response.Write "<meta name='apple-mobile-web-app-capable' content='yes'>" & vbCrLf
	Response.Write "<meta name='format-detection' content='telephone=no'>" & vbCrLf
	Response.Write "<link rel=""stylesheet"" type=""text/css"" href=""../fonts/font-awesome/css/font-awesome.min.css"" />" & vbCrLf
	Response.Write "<link href='../Plugins/layui/css/layui.css' rel='stylesheet' type='text/css' />" & vbCrLf
	Response.Write "<link href='../Style/global.css' rel='stylesheet' type='text/css' />" & vbCrLf
	Response.Write "<link href='../Style/font.css' rel='stylesheet' type='text/css' />" & vbCrLf
	Response.Write "<script type='text/javascript'>" & vbCrLf
	Response.Write "var pc_file = '" & InstallDir & "';" & vbCrLf
	Response.Write "var admin_file = '" & AdminFolder & "/';" & vbCrLf
	Response.Write "</script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../Js/Admin.js'></script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../../Dialog/main.js'></script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../../Dialog/lhgcore.min.js'></script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../../Dialog/lhgcalendar.min.js'></script>" & vbCrLf
	Response.Write "<script type=""text/javascript"" src=""../Plugins/layui/layui.js""></script>" & vbCrLf
	Response.Write "</head>" & vbCrLf
	Response.Write "<body>" & vbCrLf
	Dim AuthID
	Dim rsAdmin, sqlAdmin
	AuthID = Trim(Request("AuthID"))
	If AuthID = "" Then
		Response.Write IsSuccess("请指定要修改的权限ID！",AdminFolder & "/Admin/"&strFileName)
		Exit Sub
	Else
		AuthID = Code_CLng(AuthID)
	End If
	sqlAdmin = "Select * From ["&Data_Name&"] where AuthID=" & AuthID
	Call Exe_Conn(rsAdmin,sqlAdmin,3)
	If rsAdmin.BOF And rsAdmin.EOF Then
		Response.Write IsSuccess("不存在此权限！",AdminFolder & "/Admin/"&strFileName)
		rsAdmin.Close
		Set rsAdmin = Nothing
		Exit Sub

	End If
	Response.Write "<form class='layui-form layui-form-pane' id=""myform"" name=""myform"" method='post' action='" & strFileName & "'>" & vbCrLf
	Response.Write "<div class=""admin-main fadeInUp animated"">" & vbCrlf
	Response.Write "    <fieldset class=""layui-elem-field layui-field-title"">" & vbCrlf
	Response.Write "        <legend>修改权限</legend>" & vbCrlf
	Response.Write "    </fieldset>" & vbCrlf
	Response.Write "    <div class=""layui-form-item"">" & vbCrlf
	Response.Write "        <label class=""layui-form-label"">权限名称：</label>" & vbCrlf
	Response.Write "        <div class=""layui-input-4"">" & vbCrlf
	Response.Write "            <input name=""title"" type=""text"" id=""title"" size=""30"" maxlength=""255"" value=""" & rsAdmin("title") & """ lay-verify=""required"" placeholder=""请输入权限名称"" class=""layui-input"">" & vbCrlf
	Response.Write "        </div>" & vbCrlf
	Response.Write "    </div>" & vbCrlf
	Response.Write "    <div class=""layui-form-item"">" & vbCrlf
	Response.Write "        <label class=""layui-form-label"">权限链接：</label>" & vbCrlf
	Response.Write "        <div class=""layui-input-4"">" & vbCrlf
	Response.Write "            <input name=""href"" type=""text"" id=""href"" size=""30"" maxlength=""255"" value=""" & rsAdmin("href") & """ lay-verify=""required"" placeholder=""请输入权限链接"" class=""layui-input"">" & vbCrlf
	Response.Write "        </div>" & vbCrlf
	Response.Write "    </div>" & vbCrlf
	Response.Write "    <div class=""layui-form-item"">" & vbCrlf
	Response.Write "        <label class=""layui-form-label"">图标名称：</label>" & vbCrlf
	Response.Write "        <div class=""layui-input-4"">" & vbCrlf
	Response.Write "            <input name=""icon"" type=""text"" id=""icon"" size=""30"" maxlength=""255"" value=""" & rsAdmin("icon") & """ placeholder=""请输入图标名称"" class=""layui-input"">" & vbCrlf
	Response.Write "        </div>" & vbCrlf
	Response.Write "    </div>" & vbCrlf
	Response.Write "    <div class=""layui-form-item"">" & vbCrlf
	Response.Write "        <label class=""layui-form-label"">状态：</label>" & vbCrlf
	Response.Write "        <div class=""layui-input-4"">" & vbCrlf
	Response.Write "            <input id='menustatus' name='menustatus' type='radio' value='1' checked title='开启' lay-filter='menustatus'"
	If rsAdmin("menustatus") = 1 Then Response.Write " checked"
	Response.Write "><input type='radio' id='menustatus' name='menustatus' value='0' title='关闭' lay-filter='menustatus'"
	If rsAdmin("menustatus") = 0 Then Response.Write " checked"
	Response.Write ">" & vbCrlf
	Response.Write "        </div>" & vbCrlf
	Response.Write "    </div>" & vbCrlf
	Response.Write "    <div class=""layui-form-item"">" & vbCrlf
	Response.Write "        <label class=""layui-form-label"">排序：</label>" & vbCrlf
	Response.Write "        <div class=""layui-input-4"">" & vbCrlf
	Response.Write "            <input name=""sort"" type=""text"" id=""sort"" size=""30"" maxlength=""255"" value=""" & rsAdmin("sort") & """ lay-verify=""required"" placeholder=""请输入排序编号"" class=""layui-input"">" & vbCrlf
	Response.Write "        </div>" & vbCrlf
	Response.Write "    </div>" & vbCrlf
	Response.Write "</div>" & vbCrlf
	Response.Write "<br>" & vbCrlf
	Response.Write "<br>" & vbCrlf
	Response.Write "<br>" & vbCrlf
	Response.Write "<br>" & vbCrlf
	Response.Write "<br>" & vbCrlf
	Response.Write "<br>" & vbCrlf
	Response.Write "<br>" & vbCrlf
	Response.Write "<br>" & vbCrlf
	Response.Write "<input name='AuthID' type='hidden' value='" & rsAdmin("AuthID") & "'><input type=""hidden"" name=""Action"" id='Action' value=""SaveModify""><input name='Scode' type='hidden' id='Scode' value='" & CheckSecretCode("start") & "'>" & Submit_Layui("提交修改","重新填写","确认要清空对话框内容？","javascript:history.back();","返回上一页","") & vbCrlf
	Response.Write "</form>" & vbCrLf
	Response.Write "<script>" & vbCrlf
	Response.Write "layui.use(['form'], function () {" & vbCrlf
	Response.Write "    var form = layui.form;" & vbCrlf
	Response.Write "    //提交监听" & vbCrlf
	Response.Write "    form.on('submit(submit)', function (data) {" & vbCrlf
	Response.Write "        loading = layer.load(1, {shade: [0.1,'#fff']});" & vbCrlf
	Response.Write "        $.ajax({" & vbCrLf
	Response.Write "            type: 'post'," & vbCrLf
	Response.Write "            url: '?Action=SaveModify'," & vbCrLf
	Response.Write "            data: data.field," & vbCrLf
	Response.Write "            dataType: 'json'," & vbCrLf
	Response.Write "            success: function(res) {" & vbCrLf
	Response.Write "                layer.close(loading);" & vbCrlf
	Response.Write "                if(res.code > 0){" & vbCrlf
	Response.Write "                    layer.msg(res.msg,{icon: 1, time: 1000},function(){" & vbCrlf
	Response.Write "                        location.href = res.url;" & vbCrlf
	Response.Write "                    });" & vbCrlf
	Response.Write "                }else{" & vbCrlf
	Response.Write "                    layer.msg(res.msg,{icon: 2, time: 1000});" & vbCrlf
	Response.Write "                }" & vbCrlf
	Response.Write "            }" & vbCrLf
	Response.Write "        });" & vbCrLf
	Response.Write "    });" & vbCrlf
	Response.Write "});" & vbCrlf
	Response.Write "</script>" & vbCrlf
	rsAdmin.Close
	Set rsAdmin = Nothing
	Response.Write "</body>" & vbCrLf & "</html>"
End Sub

Sub SaveAdd()
	If Request.ServerVariables("REQUEST_METHOD") = "POST" Then
		Dim title, rules
		Dim rsAdmin, sqlAdmin

		'验证安全码
		If CheckSecretCode(Trim(Request.Form("Scode"))) <> True Then
			Response.Write "{""code"":0,""msg"":""\u975e\u6cd5\u63d0\u4ea4\u7684\u6570\u636e\uff01""}" & vbCrLf
			Response.End()
		End If
	   
		title = Trim(Request("title"))
		href = Trim(Request("href"))
		pid = Trim(Request("pid"))
		icon = Trim(Request("icon"))
		menustatus = Trim(Request("menustatus"))
		sort = Trim(Request("sort"))

		If title = "" Then
			Response.Write "{""code"":0,""msg"":""\u6743\u9650\u540d\u4e0d\u80fd\u4e3a\u7a7a\uff01""}" & vbCrLf
			Response.End()
		End If
		
		If FoundErr = True Then Exit Sub
		
		AuthID = GetNewID(Data_Name, "AuthID")
		sqlAdmin = "Select * From ["&Data_Name&"] where title='" & title & "' and pid=" & pid & ""
		Call Exe_Conn(rsAdmin,sqlAdmin,3)
		If Not (rsAdmin.BOF And rsAdmin.EOF) Then
			Response.Write "{""code"":0,""msg"":""\u6570\u636e\u5e93\u4e2d\u5df2\u7ecf\u5b58\u5728\u6b64\u6743\u9650\uff01""}" & vbCrLf
			Response.End()
			rsAdmin.Close
			Set rsAdmin = Nothing
			Exit Sub
		End If
		
		rsAdmin.addnew
		rsAdmin("AuthID") = AuthID
		rsAdmin("title") = title
		rsAdmin("href") = href
		rsAdmin("pid") = pid
		rsAdmin("icon") = icon
		rsAdmin("menustatus") = menustatus
		rsAdmin("sort") = sort
		rsAdmin("addtime") = Time_Type(now(),1)
		rsAdmin.Update
		rsAdmin.Close
		Set rsAdmin = Nothing
		Response.Write "{""code"":1,""msg"":""\u6dfb\u52a0\u6210\u529f\uff01"",""url"":""?""}" & vbCrLf
		Response.End()
	End If
End Sub

Sub SaveModify()
	If Request.ServerVariables("REQUEST_METHOD") = "POST" Then
		Dim AuthID, title
		Dim rsAdmin, sqlAdmin
		
		'验证安全码
		If CheckSecretCode(Trim(Request.Form("Scode"))) <> True Then
			Response.Write "{""code"":0,""msg"":""\u975e\u6cd5\u63d0\u4ea4\u7684\u6570\u636e\uff01""}" & vbCrLf
			Response.End()
		End If

		AuthID = Trim(Request("AuthID"))
		title = Trim(Request("title"))
		href = Trim(Request("href"))
		icon = Trim(Request("icon"))
		menustatus = Trim(Request("menustatus"))
		sort = Trim(Request("sort"))
		If AuthID = "" Then
			Response.Write "{""code"":0,""msg"":""\u8bf7\u6307\u5b9a\u8981\u4fee\u6539\u7684\u6743\u9650ID\uff01""}" & vbCrLf
			Response.End()
		Else
			AuthID = Code_CLng(AuthID)
		End If
		If title = "" Then
			Response.Write "{""code"":0,""msg"":""\u6743\u9650\u540d\u4e0d\u80fd\u4e3a\u7a7a\uff01""}" & vbCrLf
			Response.End()
		End If
		
		If FoundErr = True Then Exit Sub
		
		sqlAdmin = "Select * From ["&Data_Name&"] where AuthID=" & AuthID
		Call Exe_Conn(rsAdmin,sqlAdmin,3)
		If rsAdmin.BOF And rsAdmin.EOF Then
			Response.Write "{""code"":0,""msg"":""\u4e0d\u5b58\u5728\u6b64\u6743\u9650\uff01""}" & vbCrLf
			Response.End()
			rsAdmin.Close
			Set rsAdmin = Nothing
			Exit Sub
		End If
		rsAdmin("title") = title
		rsAdmin("href") = href
		rsAdmin("icon") = icon
		rsAdmin("menustatus") = menustatus
		rsAdmin("sort") = sort
		rsAdmin.Update
		rsAdmin.Close
		Set rsAdmin = Nothing
		Response.Write "{""code"":1,""msg"":""\u4fee\u6539\u6210\u529f\uff01"",""url"":""?""}" & vbCrLf
		Response.End()
	End If
End Sub

Sub ListOrder()
	If Request.ServerVariables("REQUEST_METHOD") = "POST" Then
		AuthID = Code_CLng(Trim(Code_Form("AuthID")))
		sort = Code_CLng(Trim(Code_Form("sort")))
		Call Exec("","Update ["&Data_Name&"] Set sort="&sort&" Where AuthID="&AuthID,0)
		Response.Write "{""msg"":""\u6392\u5e8f\u6210\u529f\uff01"",""url"":""?"",""code"":1}"
		Response.End()
	End If
End Sub

Sub AuthOpen()
	If Request.ServerVariables("REQUEST_METHOD") = "POST" Then
		AuthID = Code_CLng(Trim(Code_Form("AuthID")))
		If AuthID = "" Then
			Response.Write "{""code"":0,""msg"":""\u8bf7\u6307\u5b9a\u8981\u4fee\u6539\u7684\u6743\u9650ID\uff01""}" & vbCrLf
			Response.End()
		Else
			AuthID = Code_CLng(AuthID)
		End If
		authopen = Trim(Code_Form("authopen"))
		Call Exec("","Update ["&Data_Name&"] Set authopen="&authopen&" Where AuthID="&AuthID,0)
		Response.Write "{""msg"":""\u4fee\u6539\u6210\u529f"",""code"":1}"
		Response.End()
	End If
End Sub

Sub AuthState()
	If Request.ServerVariables("REQUEST_METHOD") = "POST" Then
		AuthID = Code_CLng(Trim(Code_Form("AuthID")))
		If AuthID = "" Then
			Response.Write "{""code"":0,""msg"":""\u8bf7\u6307\u5b9a\u8981\u4fee\u6539\u7684\u6743\u9650ID\uff01""}" & vbCrLf
			Response.End()
		Else
			AuthID = Code_CLng(AuthID)
		End If
		menustatus = Trim(Code_Form("menustatus"))
		Call Exec("","Update ["&Data_Name&"] Set menustatus="&menustatus&" Where AuthID="&AuthID,0)
		Response.Write "{""msg"":""\u4fee\u6539\u6210\u529f"",""code"":1}"
		Response.End()
	End If
End Sub

Sub DelAuth()
	If Request.ServerVariables("REQUEST_METHOD") = "POST" Then
		Dim AuthID
		Dim rsAdmin, sqlAdmin

		'验证安全码
		'If CheckSecretCode(Trim(Request.Form("Scode"))) <> True Then
			'Response.Write "{""msg"":""\u975e\u6cd5\u63d0\u4ea4\u7684\u6570\u636e\uff01"",""code"":0}"
			'Response.End()
		'End If

		AuthID = Trim(Request.Form("AuthID"))
		If AuthID = "" Then
			Response.Write "{""msg"":""\u8bf7\u6307\u5b9a\u8981\u5220\u9664\u7684\u6743\u9650ID\uff01"",""code"":0}"
			Response.End()
		End If
		Delete_Auth(AuthID)
		Call Exec("","delete From ["&Data_Name&"] where AuthID=" & AuthID & "",0)
		Response.Write "{""msg"":""\u5220\u9664\u6210\u529f\uff01"",""code"":1}"
		Response.End()
	End If
End Sub

Function Delete_Auth(pid)
	If pid<>"" Then
		Call Exec(RsAuthDel,"Select AuthID From [Admin_Auth] Where pid="&pid&"",2)
		If RsAuthDel.BOF And RsAuthDel.EOF Then
			RsAuthDel.Close
		Else
			Do While Not RsAuthDel.Eof
				Delete_Auth(RsAuthDel("AuthID"))
				Call Exec("","Delete From Admin_Auth Where AuthID="&RsAuthDel("AuthID")&"",0)
				RsAuthDel.MoveNext
			Loop
			RsAuthDel.Close
		End If
	End If
End Function

Function Class_Add_Edit_List(opid, ipid)
	Dim rsAuth, sqlAuth, strTemp, tmpDepth, i
	sqlAuth = "Select AuthID,title From "&Data_Name&" Where pid="&opid&" Order By sort Asc,AuthID Asc"
	Call Exec(rsAuth,sqlAuth,2)
	If rsAuth.BOF And rsAuth.EOF Then
		strTemp = ""
	Else
		strTemp = ""
		Do While Not rsAuth.EOF
			strTemp = strTemp & "            {name: '"&rsAuth(1)&"', value: "&Int(rsAuth(0))&""
			If Int(rsAuth(0))=ipid Then strTemp = strTemp & ", selected: true"
			strTemp = strTemp & ", children: [" & vbCrLf
			strTemp = strTemp & Class_Add_Edit_List(Int(rsAuth(0)), ipid)
			strTemp = strTemp & "            ]}," & vbCrLf
			rsAuth.MoveNext
		Loop
	End If
	rsAuth.Close
	Set rsAuth = Nothing
	Class_Add_Edit_List = strTemp
End Function
%>